home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / Shareware Internet / Desarrolladores / PlayerPRO 4.5.1 Dev.Kit / MADH Library 4.01 / Libraries / MAD.h < prev    next >
Text File  |  1996-02-07  |  4KB  |  164 lines

  1. /********************                        ***********************/
  2. //
  3. //    Player PRO 4.5x -- MAD Music Driver Definition
  4. //
  5. //    Library Version 4.0
  6. //
  7. //    To use with MusicLibrary for Think C & CodeWarrior
  8. //
  9. //    Antoine ROSSET
  10. //    16 Tranchees
  11. //    1206 GENEVA
  12. //    SWITZERLAND
  13. //    
  14. //    FAX:            (+41 22) 346 11 97
  15. //    PHONE:         (+41 89) 203 74 62
  16. //    Compuserve:    100277,164
  17. //    Internet:         rosset@dial.eunet.ch
  18. //
  19. /********************                        ***********************/
  20.  
  21. #ifndef __MADH__
  22. #define __MADH__
  23.  
  24. #if defined(powerc) || defined (__powerc)
  25. #pragma options align=mac68k
  26. #else
  27. #if !defined(THINK_C)
  28. #pragma options align=mac68k
  29. #endif
  30. #endif
  31.  
  32. // ***    
  33. // ***    PATTERN DESCRIPTION
  34. // ***    
  35.  
  36. struct Cmd                            // COMMAND
  37. {
  38.     Byte    ins;                        // Instrument no        0x00: no ins cmd
  39.     Byte     note;                    // Note, see table        0xFF : no note cmd
  40.     Byte     cmd;                    // Effect cmd
  41.     Byte     arg;                    // Effect argument
  42.     Byte    vol;                    // Volume                0xFF : no volume cmd
  43.     Byte    unused;
  44. };
  45. typedef struct Cmd Cmd;
  46.  
  47. struct PatHeader                    // HEADER
  48. {
  49.     long    size;                    // Length of pattern: standard = 64
  50.     long    compMode;                // Compression mode, none = 'NONE'
  51.     char    name[ 32];
  52.     long    patBytes;                // Pattern Size in Bytes
  53.     long    unused2;
  54. };
  55. typedef struct PatHeader PatHeader;
  56.  
  57. struct PatData                        // DATA STRUCTURE : HEADER + COMMANDS
  58. {                                    // Pattern = 64 notes to play
  59.     PatHeader    header;
  60.     Cmd        Cmds[];
  61. };
  62. typedef struct PatData PatData;
  63.  
  64.  
  65.  
  66. // ***    
  67. // ***    INSTRUMENT DESCRIPTION
  68. // ***    
  69.  
  70.  
  71. struct sData                                // SAMPLE
  72. {
  73.     long                 size;                // Sample length
  74.     long                loopBeg;            // LoopStart
  75.     long                loopSize;            // LoopLength
  76.     Byte                 vol;                // Base volume
  77.     unsigned short        c2spd;                // c2spd
  78.     Byte                loopType;
  79.     Byte                amp;                // 8 or 16 bits
  80.     Byte                panning;
  81.     char                relNote;
  82.     char                 name[ 32];            // Sample name
  83.     Ptr                    data;                // Used only in memory, not in files
  84. };
  85. typedef struct sData sData;
  86.  
  87. struct EnvRec                // Volume Enveloppe
  88. {
  89.     short     pos;                // pos
  90.     short    val;                // val
  91. };
  92. typedef struct EnvRec EnvRec;
  93.  
  94. enum
  95. {
  96.     EF_ON            = 1,
  97.     EF_SUSTAIN    = 2,
  98.     EF_LOOP        = 4
  99. };
  100.  
  101. struct InstrData                // INSTRUMENT
  102. {
  103.     char     name[ 32];            // instrument name
  104.     Byte     type;                // Instrument type = 0
  105.  
  106.     short    numSamples;        // Number of samples in instrument
  107.  
  108.     /**/
  109.  
  110.     Byte        what[ 96];        // Sample number for all notes
  111.     EnvRec         volEnv[ 12];    // Points for volume envelope
  112.     EnvRec        pannEnv[ 12];    // Points for panning envelope
  113.     
  114.     Byte    volSize;            // Number of volume points
  115.     Byte    pannSize;            // Number of panning points
  116.     
  117.     Byte    volSus;                // Volume sustain point
  118.     Byte    volBeg;                // Volume loop start point
  119.     Byte    volEnd;                // Volume loop end point
  120.     
  121.     Byte    pannSus;            // Panning sustain point
  122.     Byte    pannBeg;            // Panning loop start point
  123.     Byte    pannEnd;            // Panning loop end point
  124.  
  125.     Byte    volType;            // Volume type: bit 0: On; 1: Sustain; 2: Loop
  126.     Byte    pannType;            // Panning type: bit 0: On; 1: Sustain; 2: Loop
  127.     
  128.     unsigned short    volFade;    // Volume fadeout
  129.     
  130.     Byte    vibDepth;
  131.     Byte    vibRate;
  132. };
  133. typedef struct InstrData InstrData;
  134.  
  135.  
  136.  
  137. // ***    
  138. // ***    MAD FILE HEADER DESCRIPTION
  139. // ***    
  140.  
  141.  
  142. struct MADSpec
  143. {
  144.     long        MAD;                        // Mad Identification: MADG in version 2.0
  145.     char         name[ 32];                    // Music's name
  146.     char        infos[ 256];                // Informations & Author name of the music
  147.     Byte        numPat;                    // Patterns number
  148.     Byte        numChn;                    // Channels number
  149.     Byte         numPointers;                // Partition length
  150.     Byte        oPointers[ 256];            // Partition : Patterns ID List
  151.     short        speed;                        // Default speed
  152.     short        tempo;                        // Default tempo
  153.     InstrData     fid[ 64];                    // Instruments description
  154. };
  155. typedef struct MADSpec MADSpec;
  156.  
  157. #if defined(powerc) || defined (__powerc)
  158. #pragma options align=reset
  159. #else
  160. #if !defined(THINK_C)
  161. #pragma options align=reset
  162. #endif
  163. #endif
  164. #endif